<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html>
<html lang="zh-CN">
  
  <head>
    
    <%@ include file="/WEB-INF/include/meta.jsp"%>
    <%@ include file="/WEB-INF/include/css.jsp"%>
    
  </head>
  <!-- end header -->
  <body>
    <div class="page-group">
      <div class="page page-current">
        
        <header class="bar bar-nav fs-header-small">
          <a href="${ctx.host}/profile/courses" class="icon icon-left pull-left"></a>
          <h1 class="title">我的课程</h1>
        </header>
        
        <div class="content">
        
          <div class="list-block media-list no-margin">
            <ul>
              <li class="course">
                <div class="item-content">
                  <div class="item-media"><img src="${cloud.prod}/${courseRound.course.cover}-avatar" style='width: 4rem;'></div>
                  <div class="item-inner">
                    <div class="item-title-row">
                      <div class="item-title">${courseRound.course.name}</div>
                    </div>
                    <div class="item-subtitle" style="margin: .3rem 0;">${courseRound.site.name}</div>
                    <div class="item-text" style="height: 1.4rem;">
                      <c:choose>
                        <c:when test="${courseRound.product.course.online}">
                          共&nbsp;<span class="color-blue">${courseRound.attrs['course_amount'].value == null ? courseRound.course.hours : courseRound.attrs['course_amount'].value}</span>&nbsp;天<br>
                        </c:when>
                        <c:otherwise>
                          共&nbsp;<span class="color-blue">${courseRound.attrs['course_amount'].value == null ? courseRound.course.hours : courseRound.attrs['course_amount'].value}</span>&nbsp;节课，已完成&nbsp;<span class="color-blue">${courseRound.finished}</span>&nbsp;节课<br>
                        </c:otherwise>
                      </c:choose>
                    </div>
                  </div>
                </div>
              </li>
            </ul>
          </div>
           <div class="schedule-warp" style="margin-top: 1rem;">
             <div class="content-padded no-margin">
               <div class="row course-schedule">
                 <c:choose>
                  <c:when test="${courseRound.courseStatus.coach}">
                    <p class="text-center color-danger">分配教练中</p>
                  </c:when>
                  <c:when test="${courseRound.courseStatus.group && courseRound.course.online}">
                    <p class="text-center color-danger"></p>
                  </c:when>
                  <c:when test="${courseRound.courseStatus.group && !courseRound.course.online}">
                    <p class="text-center color-danger">分派团课中</p>
                  </c:when>
                  <c:when test="${empty courseRound.schedules}">
                    <p class="text-center color-danger">待排课</p>
                  </c:when>
                  <c:otherwise>
                    
                     <c:forEach var="courseSchedule" items="${courseRound.schedules}" varStatus="status">
                       <c:choose>
                         <c:when test="${courseSchedule.scheduleStatus.finish}">
                           <div class="col-33 finished">
                             <p>
                               <fmt:formatDate value="${courseSchedule.occurDate}" pattern="MM月dd日"/><br>
                               ${courseSchedule.occurHour}
                             </p>
                             <img src="${ctx.resource}/image/signed.png" style="width: 30px; height: 30px;">
                             <span class="number">${status.index + 1}</span>
                             <a href="${ctx.host}/profile/course-schedules/${courseSchedule.id}"></a>
                           </div>
                         </c:when>
                         <c:when test="${courseSchedule.scheduleStatus.ready}">
                           <div class="col-33 waiting">
                             <p>
                               <fmt:formatDate value="${courseSchedule.occurDate}" pattern="MM月dd日"/><br>
                               ${courseSchedule.occurHour}
                           	 </p>
                            <span class="number">${status.index + 1}</span>
                            <a href="${ctx.host}/profile/course-schedules/${courseSchedule.id}"></a>
                           </div>
                         </c:when>
                         <c:when test="${courseSchedule.scheduleStatus.schedule}">
                           <div class="col-33 undo">
                             <p>待排课</p>
                             <span class="number">${status.index + 1}</span>
                           </div>
                         </c:when>
                         <c:when test="${courseSchedule.scheduleStatus.expiry}">
                           <div class="col-33 expiry">
                             <p>
                               <fmt:formatDate value="${courseSchedule.occurDate}" pattern="MM月dd日"/><br>
                               ${courseSchedule.occurHour}（逾期）
                            </p>
                            <span class="number">${status.index + 1}</span>
                            <a href="${ctx.host}/profile/course-schedules/${courseSchedule.id}"></a>
                           </div>
                         </c:when>
                         <c:otherwise>
                           <div class="col-33 undo">
                             <p>待排课</p>
                             <span class="number">${status.index + 1}</span>
                           </div>
                         </c:otherwise>
                       </c:choose>
                     </c:forEach>
                     
                  </c:otherwise>
                 </c:choose>
               </div>
             </div>
           </div>
          
        </div>
        <!-- End Content -->
        
      </div>
    </div>
    
    <%@ include file="/WEB-INF/include/script.jsp"%>
    
  </body>
</html>